package com.itheima.controller;

import com.itheima.pojo.Account;
import com.itheima.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import java.util.List;

@Controller
public class AccountController {
    @Autowired
    private AccountService accountService;

    public List<Account> findAll() {
        return accountService.findAll();
    }

    public void insertAccount(Account account) {
        accountService.insertAccount(account);
    }

    public Account findById(int id) {
        return accountService.findById(id);
    }

    public void transfer(String fromName, String toName, double money) {
        accountService.transfer(fromName, toName, money);
    }

    public void updateAccount(Account account) {
        accountService.updateAccount(account);
    }

    public void deleteAccount(int id) {
        accountService.deleteAccount(id);
    }
}
